<template>
  <LineChart
    label="timestamp"
    :datasets="datasets"
    :data="data"
    :formatter="true"
  />
</template>

<script setup>
import { computed } from 'vue';
import LineChart from './line-chart.vue';

const props = defineProps({
  data: Array
});

const datasets = computed(() => {
  const hasMetaspace = Object.values(props.data).some((d) => d.metaspace !== null);
  return hasMetaspace ? ['metaspace', 'used', 'committed'] : ['used', 'committed'];
});
</script>
